//
//  NYTopicListTableViewCell.m
//  Nooryes
//
//  Created by baken on 2020/3/3.
//  Copyright © 2020 MyApp. All rights reserved.
//

#import "NYTopicListTableViewCell.h"
#import "NYTopicListModel.h"

@interface NYTopicListTableViewCell()
@property (weak, nonatomic) IBOutlet UILabel *title;
@property (weak, nonatomic) IBOutlet UILabel *count;
@property (weak, nonatomic) IBOutlet UIImageView *image1;
@property (weak, nonatomic) IBOutlet UIImageView *image2;
@property (weak, nonatomic) IBOutlet UIImageView *image3;


@end

@implementation NYTopicListTableViewCell

+(instancetype)cellWithTableView:(UITableView *)tableView{
    NYTopicListTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kNYTopicListTableViewCell];
    if (!cell) {
        cell = [[NSBundle mainBundle] loadNibNamed:kNYTopicListTableViewCell owner:nil options:nil].firstObject;
    }
    return cell;
}

-(void)setModel:(TopicListModel *)model{
    _model = model;
    self.title.text = model.name;
    self.count.text = [NSString stringWithFormat:@"%@篇文章",model.count];
    if (model.images.count == 3) {
        [self.image1 sd_setImageWithURL:[NSURL URLWithString:model.images[0]]];
        [self.image2 sd_setImageWithURL:[NSURL URLWithString:model.images[1]]];
        [self.image3 sd_setImageWithURL:[NSURL URLWithString:model.images[2]]];
    }
}
@end
